package com.bw.lib_core.network;

public
class RetrofitFactory {

    private static NormalRetrofitImpl normalRetrofit;
    private static TokenRetrofitImpl tokenRetrofit;
    private static SignRetrofitImpl signRetrofit;
    private static SignTokenRetrofitImpl signTokenRetrofit;

    public static IProduct create(HttpType type) {
        IProduct iProduct = null;
        switch (type) {
            case SIGN:
                if (signRetrofit == null) {
                    signRetrofit = new SignRetrofitImpl();
                }
                iProduct = signRetrofit;
                break;
            case NORMAL:
                if (normalRetrofit == null) {
                    normalRetrofit = new NormalRetrofitImpl();
                }
                iProduct = normalRetrofit;
                break;
            case TOKEN:
                if (tokenRetrofit == null) {
                    tokenRetrofit = new TokenRetrofitImpl();
                }
                iProduct = tokenRetrofit;
                break;
            case SIGN_TOKEN:
                if (signTokenRetrofit == null) {
                    signTokenRetrofit = new SignTokenRetrofitImpl();
                }
                iProduct = signTokenRetrofit;
                break;
        }
        return iProduct;
    }
}
